<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>주소/우편번호 검색</title>
<link type="text/css" href="./common/css/style.css" rel="stylesheet" />
<script type="text/JavaScript">
	function dongCheck() {
		if (document.zipForm.area3.value == "") {
			alert("동이름을 입력하세요");
			document.zipForm.dong.focus();
			return false;
		}
		return true;
	}
	function sendAddress(zipcode, area1, area2, area3, area4) {
		var zip = zipcode;
		var address = area1 + " " + area2 + " " + area3 + " " + area4;
		opener.document.memberForm.zipcode.value = zip;
		opener.document.memberForm.addr1.value = address;
		self.close();
	}
	window.onload = function() {
		document.zipForm.area3.focus();
	}
</script>
</head>
<body>
<h2 class="page_title"><strong>주소/우편번호 검색</strong></h2>

<form name="zipForm" method="post" action="zipCheckAction.action">
	<p class="align_c mar_b_20">찾으시는 주소의 <strong>동</strong>을 입력해주세요.</p>
	<p class="align_c">
		<input type="text" name="area3" value="${area3}" maxlength="10" style="ime-mode: active;">
		<input type="submit" value="검 색" onclick="return dongCheck();" />
	</p>
</form>
<div class="zipcodeList">
	<s:if test="zipcodeList.size() <= 0">
		<p>검색된 내용이 없습니다.</p>
	</s:if>
	<s:else>
		<s:iterator value="zipcodeList" status="rowStatus">
		<p>
			<a href="javascript:sendAddress(
			    '<s:property value="zipcode"/>',
			    '<s:property value="area1"/>',
			    '<s:property value="area2"/>',
			    '<s:property value="area3"/>',
			    '<s:property value="area4"/>'
			    );">
				<strong><s:property value="zipcode" /></strong>&nbsp; 
				<s:property value="area1" /> 
				<s:property value="area2" /> 
				<s:property value="area3" /> 
				<s:property value="area4" />
			</a>
		</p>
		</s:iterator>
	</s:else>
</div>
<p class="align_c"><a href="javascript:this.close();"><strong>닫기</strong></a></p>
</body>
</html>